home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 19 / Amiga Plus Leser CD 19.iso / Tools / MorphOS / cvs-1.11.2 / source / amiga / SDI_compiler.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-11-18  |  4.0 KB  |  171 lines

  1. #ifndef SDI_COMPILER_H
  2. #define SDI_COMPILER_H
  3.  
  4. /* Includeheader
  5.  
  6.         Name:           SDI_compiler.h
  7.         Versionstring:  $VER: SDI_compiler.h 1.11 (09.11.2002)
  8.         Author:         SDI
  9.         Distribution:   PD
  10.         Description:    defines to hide compiler stuff
  11.  
  12.  1.1   25.06.98 : created from data made by Gunter Nikl
  13.  1.2   17.11.99 : added VBCC
  14.  1.3   29.02.00 : fixed VBCC REG define
  15.  1.4   30.03.00 : fixed SAVEDS for VBCC
  16.  1.5   29.07.00 : added #undef statements (needed e.g. for AmiTCP together
  17.         with vbcc)
  18.  1.6   19.05.01 : added STACKEXT and Dice stuff
  19.  1.7   16.06.01 : added MorphOS specials and VARARGS68K
  20.  1.8   21.09.02 : added MorphOS register stuff
  21.  1.9   26.09.02 : added OFFSET macro. Thanks Frank Wille for suggestion
  22.  1.10  18.10.02 : reverted to old MorphOS-method for GCC
  23.  1.11  09.11.02 : added REGARGS define to MorphOS section
  24. */
  25.  
  26. /*
  27. ** This is PD (Public Domain). This means you can do with it whatever you want
  28. ** without any restrictions. I only ask you to tell me improvements, so I may
  29. ** fix the main line of this files as well.
  30. **
  31. ** To keep confusion level low: When changing this file, please note it in
  32. ** above history list and indicate that the change was not made by myself
  33. ** (e.g. add your name or nick name).
  34. **
  35. ** Dirk Stöcker <stoecker@epost.de>
  36. */
  37.  
  38. #ifdef ASM
  39. #undef ASM
  40. #endif
  41. #ifdef REG
  42. #undef REG
  43. #endif
  44. #ifdef LREG
  45. #undef LREG
  46. #endif
  47. #ifdef CONST
  48. #undef CONST
  49. #endif
  50. #ifdef SAVEDS
  51. #undef SAVEDS
  52. #endif
  53. #ifdef INLINE
  54. #undef INLINE
  55. #endif
  56. #ifdef REGARGS
  57. #undef REGARGS
  58. #endif
  59. #ifdef STDARGS
  60. #undef STDARGS
  61. #endif
  62. #ifdef OFFSET
  63. #undef OFFSET
  64. #endif
  65.  
  66. /* first "exceptions" */
  67.  
  68. #if defined(__MAXON__)
  69.   #define STDARGS
  70.   #define STACKEXT
  71.   #define REGARGS
  72.   #define SAVEDS
  73.   #define INLINE inline
  74. #elif defined(__VBCC__)
  75.   #define STDARGS
  76.   #define STACKEXT
  77.   #define REGARGS
  78.   #define INLINE
  79.   #define OFFSET(p,m) __offsetof(struct p,m)
  80.   #if defined(__MORPHOS__)
  81.     #define REG(reg,arg) __reg(MOS__##reg) arg
  82.  
  83.     /* NOTE: This assumes "quick native mode" when compiling libraries. */
  84.     #define MOS__a0 "r24"
  85.     #define MOS__a1 "r25"
  86.     #define MOS__a2 "r26"
  87.     #define MOS__a3 "r27"
  88.     #define MOS__a4 "r28"
  89.     #define MOS__a5 "r29"
  90.     #define MOS__a6 "r30"
  91.     /* #define MOS__a7 "r31" */
  92.     #define MOS__d0 "r16"
  93.     #define MOS__d1 "r17"
  94.     #define MOS__d2 "r18"
  95.     #define MOS__d3 "r19"
  96.     #define MOS__d4 "r20"
  97.     #define MOS__d5 "r21"
  98.     #define MOS__d6 "r22"
  99.     #define MOS__d7 "r23"
  100.  
  101.   #else
  102.     #define REG(reg,arg) __reg(#reg) arg
  103.   #endif
  104. #elif defined(__STORM__)
  105.   #define STDARGS
  106.   #define STACKEXT
  107.   #define REGARGS
  108.   #define INLINE inline
  109. #elif defined(__SASC)
  110.   #define ASM(arg) arg __asm
  111. #elif defined(__GNUC__)
  112.   #define REG(reg,arg) arg __asm(#reg)
  113.   #define LREG(reg,arg) register REG(reg,arg)
  114.  
  115.   /* Don`t use __stackext for the MorphOS version
  116.      because we anyway don`t have a libnix ppc with stackext
  117.      Also we define a VARARGS68K define here to specify
  118.      functions that should work with that special attribute
  119.      of the MOS gcc compiler for varargs68k handling. */
  120.   #if defined(__MORPHOS__)
  121.     #define STDARGS
  122.     #define STACKEXT
  123.     #define REGARGS
  124.     #define VARARGS68K  __attribute__((varargs68k))
  125.   #endif
  126. #elif defined(_DCC)
  127.   #define REG(reg,arg) __##reg arg
  128.   #define STACKEXT __stkcheck
  129.   #define STDARGS __stkargs
  130.   #define INLINE static
  131. #endif
  132.  
  133. /* then "common" ones */
  134.  
  135. #if !defined(ASM)
  136.   #define ASM(arg) arg
  137. #endif
  138. #if !defined(REG)
  139.   #define REG(reg,arg) register __##reg arg
  140. #endif
  141. #if !defined(LREG)
  142.   #define LREG(reg,arg) register arg
  143. #endif
  144. #if !defined(CONST)
  145.   #define CONST const
  146. #endif
  147. #if !defined(SAVEDS)
  148.   #define SAVEDS __saveds
  149. #endif
  150. #if !defined(INLINE)
  151.   #define INLINE static __inline
  152. #endif
  153. #if !defined(REGARGS)
  154.   #define REGARGS __regargs
  155. #endif
  156. #if !defined(STDARGS)
  157.   #define STDARGS __stdargs
  158. #endif
  159. #if !defined(STACKEXT)
  160.   #define STACKEXT __stackext
  161. #endif
  162. #if !defined(VARARGS68K)
  163.   #define VARARGS68K
  164. #endif
  165. #if !defined(OFFSET)
  166.   #define OFFSET(structName, structEntry) \
  167.     ((char *)(&(((struct structName *)0)->structEntry))-(char *)0)
  168. #endif
  169.  
  170. #endif /* SDI_COMPILER_H */
  171.